* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background-color: #f0f2f5;
}

.container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 20px;
}

#login-container {
  max-width: 400px;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-align: center;
}

#login-container input {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#login-container button {
  width: 100%;
  padding: 10px;
  background: #0084ff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#chat-container {
  display: grid;
  grid-template-columns: 250px 1fr 300px;
  gap: 20px;
  height: calc(100vh - 40px);
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar {
  padding: 20px;
  border-right: 1px solid #ddd;
}

.user-info {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #ddd;
}

#status-select {
  width: 100%;
  padding: 5px;
  margin-top: 10px;
}

.online-users {
  overflow-y: auto;
}

.online-users h3 {
  margin-bottom: 10px;
}

#users-list {
  list-style: none;
}

#users-list li {
  padding: 10px;
  cursor: pointer;
  border-radius: 4px;
}

#users-list li:hover {
  background: #f0f2f5;
}

.chat-area {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  padding: 20px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.message {
  margin-bottom: 15px;
  padding: 10px;
  border-radius: 8px;
  max-width: 70%;
  position: relative;
}

.message.sent {
  background: #0084ff;
  color: white;
  margin-left: auto;
}

.message.received {
  background: #f0f2f5;
}

.message .username {
  font-size: 0.8em;
  margin-bottom: 5px;
  opacity: 0.7;
}

.message .timestamp {
  font-size: 0.7em;
  opacity: 0.6;
  margin-top: 5px;
}

.input-area {
  padding: 20px;
  border-top: 1px solid #ddd;
  display: flex;
  gap: 10px;
}

.input-area input {
  flex: 1;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.input-area button {
  padding: 10px 20px;
  background: #0084ff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.private-chat {
  border-left: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.badge {
  background: #ff3b30;
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.8em;
}

.hidden {
  display: none !important;
}

.user-status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}

.status-online {
  background: #34c759;
}

.status-away {
  background: #ff9500;
}

.status-offline {
  background: #8e8e93;
}

.read-status {
  font-size: 0.7em;
  margin-top: 5px;
  color: #8e8e93;
}

.message:hover .delete-message {
  display: block;
}

.delete-message {
  display: none;
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 5px 10px;
  background: rgba(255, 59, 48, 0.9);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  z-index: 1;
}

.message:hover .delete-message {
  display: block;
}

.delete-message:hover {
  background: rgb(255, 59, 48);
}

/* 增加删除按钮的可点击区域 */
.delete-message::before {
  content: '';
  position: absolute;
  top: -5px;
  right: -5px;
  bottom: -5px;
  left: -5px;
  z-index: -1;
}

.message.system {
  max-width: 100%;
  text-align: center;
  background: none;
  padding: 5px;
  color: #8e8e93;
  font-size: 12px;
  margin: 10px 0;
}

.message.system .timestamp {
  display: none;
}

.file-button {
  padding: 10px;
  background: #f0f2f5;
  color: #333;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-button:hover {
  background: #e4e6e9;
}

.file-icon {
  font-size: 18px;
}

.file-message {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px;
  background: #f0f2f5;
  border-radius: 4px;
  margin-top: 5px;
}

.file-message .file-icon {
  font-size: 24px;
}

.file-message .file-info {
  flex: 1;
}

.file-message .file-name {
  font-weight: bold;
}

.file-message .file-size {
  font-size: 0.8em;
  color: #666;
}

.file-message .download-button {
  padding: 5px 10px;
  background: #0084ff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.file-message .download-button:hover {
  background: #0073e6;
}

#login-container input[type="password"] {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.secondary-button {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  background: #f0f2f5;
  color: #333;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.secondary-button:hover {
  background: #e4e6e9;
}

#register-form {
  animation: fadeIn 0.3s ease-in-out;
}

#login-form {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}